Skip to content

Add promise rejection handler to delayed MeshMapper API post#9

Merged
MrAlders0n merged 2 commits into
mainfrom
copilot/fix-meshmapper-api-posts
Dec 17, 2025
Merged

Add promise rejection handler to delayed MeshMapper API post#9
MrAlders0n merged 2 commits into
mainfrom
copilot/fix-meshmapper-api-posts

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 17, 2025

PR #8 introduced a 7-second setTimeout delay for API posts but left the async function call unhandled. Unhandled promise rejections fail silently in setTimeout callbacks, breaking all API submissions.

Changes:

  • Added .catch() handler to postToMeshMapperAPI() call in sendPing()
  • Logs errors with context: "Delayed API post failed:"
// Before: Promise rejection silently fails
setTimeout(() => {
  postToMeshMapperAPI(lat, lon);
}, MESHMAPPER_API_DELAY_MS);

// After: Errors properly caught and logged
setTimeout(() => {
  postToMeshMapperAPI(lat, lon).catch(err => {
    console.error("Delayed API post failed:", err);
  });
}, MESHMAPPER_API_DELAY_MS);

The 7-second delay (for mesh propagation) is preserved. Internal try-catch in postToMeshMapperAPI handles expected errors; this catches promise-level failures.

Original prompt

Add 7-second delay to MeshMapper API posts after ping transmission #8

This broke the app, its no longer posting to the API at all


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MeshMapper API posts after adding delay Add promise rejection handler to delayed MeshMapper API post Dec 17, 2025
Copilot AI requested a review from MrAlders0n December 17, 2025 19:17
@MrAlders0n MrAlders0n marked this pull request as ready for review December 17, 2025 19:18
@MrAlders0n MrAlders0n merged commit 49b00e0 into main Dec 17, 2025
@MrAlders0n MrAlders0n deleted the copilot/fix-meshmapper-api-posts branch December 18, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants